#ifndef _COMMON_BINARY_H_
#define _COMMON_BINARY_H_

int base64_encode(const unsigned char* inbuf, int inlen, char* outbuf, int outlen);
int base64_decode(const unsigned char* inbuf, int inlen, char* outbuf, int outlen);

int hexify_encode(const unsigned char* inbuf, int inlen, char* outbuf, int outlen);
int hexify_decode(const unsigned char* inbuf, int inlen, char* outbuf, int outlen);

int  file_size(char* filename);
bool file_read(char* filename, char* outbuf, int outlen);
bool file_write(char* filename, const char* inbuf, int inlen, bool isapp = false);

int split_utf8(const unsigned char* inbuf, int inlen, int howmany);
int ucs2_utf8(const unsigned short* inbuf, int inlen, unsigned char* outbuf, int outlen);
int utf8_ucs2(const unsigned char* inbuf, int inlen, unsigned short* outbuf, int outlen);

#endif //_COMMON_BINARY_H_
